package file;

import java.io.File;

public class ListFilesDemo {
    public static void main(String[] args) {
        File file = new File(".");
        if (file.isDirectory()){
            File[] str = file.listFiles();
            for (File s:str){
                System.out.println(s.getName());
            }
        }else {
            System.out.println("这不是一个目录");
        }
    }
}
